import path from 'path';
import GlobalConstant from './GlobalConstant';
import { PathFinder } from '../utils/path_manager';

export class PythonRunner {
  static getPythonExecutablePath(): string {
    const isWindows = process.platform === 'win32';
    const pythonExe = isWindows ? 'python.exe' : 'python3';

    if (GlobalConstant.USE_EXTERNAL_SDK) {
      // 直接用系统或外部 SDK 的 python
      return pythonExe;
    } else {
      // 用虚拟环境中的 python
      const binPath = path.join(
        PathFinder.VENV_PATH,
        isWindows ? 'Scripts' : 'bin',
      );
      return path.join(binPath, pythonExe);
    }
  }
}
